package cn.tedu.charging.order.rabbitmq;

import cn.tedu.charging.order.config.RabbitMQConfig;
import cn.tedu.charging.order.pojo.po.OrderMQPO;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * rabbit-mq 发送者
 */
@Component
public class RabbitMQOrderProducer {
    @Resource
    private RabbitTemplate rabbitTemplate;

    public void sendOrder(OrderMQPO orderMQPO) {
        rabbitTemplate.convertAndSend(RabbitMQConfig.ORDER_EXCHANGE,
                RabbitMQConfig.ORDER_ROUTING_KEY,
                orderMQPO);
    }
}
